package cn.edu.qzuie.artist.module.td.dal.mysql.teacher;

import java.util.*;

import cn.edu.qzuie.artist.framework.common.pojo.PageResult;
import cn.edu.qzuie.artist.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.edu.qzuie.artist.framework.mybatis.core.mapper.BaseMapperX;
import cn.edu.qzuie.artist.module.td.dal.dataobject.teacher.TeacherDO;
import org.apache.ibatis.annotations.Mapper;
import cn.edu.qzuie.artist.module.td.controller.admin.teacher.vo.*;

/**
 * 教师 Mapper
 *
 * @author 泉信管理员
 */
@Mapper
public interface TeacherMapper extends BaseMapperX<TeacherDO> {
    default TeacherDO selectByTeacherNo(String teacherNo){
        return selectOne(TeacherDO::getTeacherNo,teacherNo);
    }

    default PageResult<TeacherDO> selectPage(TeacherPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TeacherDO>()
                .eqIfPresent(TeacherDO::getDepartId, reqVO.getDepartId())
                .eqIfPresent(TeacherDO::getTeacherNo, reqVO.getTeacherNo())
                .likeIfPresent(TeacherDO::getRealName, reqVO.getRealName())
                .eqIfPresent(TeacherDO::getGender, reqVO.getGender())
                .betweenIfPresent(TeacherDO::getHiredate, reqVO.getHiredate())
                .eqIfPresent(TeacherDO::getTitle, reqVO.getTitle())
                .eqIfPresent(TeacherDO::getTeacherState, reqVO.getTeacherState())
                .orderByDesc(TeacherDO::getId));
    }





}